﻿<Window x:Class="App_AerCloudDemo.BrowseSearchResults"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:views="clr-namespace:App_AerCloudDemo.GUI.Views"
        Title="AerCloud.net Demo - Search Browser" MinHeight="400" MinWidth="420" Width="800" Height="600">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="91*"/>
        </Grid.RowDefinitions>
        <DataGrid ItemsSource="{Binding Path=Items}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" 
                  Grid.Row="1" HorizontalGridLinesBrush="#FFB8B6B6" VerticalGridLinesBrush="#FFB8B6B6" >
            <DataGrid.Resources>
                <!-- .net 4.5 <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="LightBlue" /> -->
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightBlue" />
                <!-- .net 4.5 <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black"/> -->
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
            </DataGrid.Resources>

            <DataGrid.CellStyle>
                <Style TargetType="{x:Type DataGridCell}">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="BorderBrush" Value="Transparent"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.CellStyle>
            
            <DataGrid.Columns>
                
                <DataGridTemplateColumn Header="Text" Width="200"  CanUserSort="True" SortMemberPath="Text" IsReadOnly="True" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Text}" Margin="4,0" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="Similarity %" Width="100"  CanUserSort="True" SortMemberPath="matchScore" IsReadOnly="True" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding matchScore, StringFormat='%{0:#0.00}'}" Margin="4,0" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                
                <DataGridTemplateColumn Header="Database Image" Width="Auto" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding Source}" HorizontalAlignment="Left" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="Query Image" Width="Auto" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding QueryImage.Source}" HorizontalAlignment="Left" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                
            </DataGrid.Columns>

        </DataGrid>
        <Label Name="lblSearching" FontSize="48" Grid.Row="0" Grid.RowSpan="2" Background="AliceBlue" Margin="0, 0, 0, 0" Cursor="Wait" Content="Searching..." VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
    </Grid>
</Window>